﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UCOLOR.Helpers;
using UCOLOR.Model;

namespace UCOLOR.View
{
    /// <summary>
    /// HomeView.xaml 的交互逻辑
    /// </summary>
    public partial class VProductView :  ModuleView 
    {
        public VProductView()
        {
            InitializeComponent();
        }


        public VProductView(int productID)
        {
           // product = DataHelper.getProduct(productID);
            InitializeComponent();
            (Product.Content as Image).Source = product.PhotoSource;
            ProductName.Content = product.ProductName;
            ProductPrice.Content = product.Price;
        }


        public Product product
        {
            get;set;
        }



        public IList<Product> data2
        {
            get;
            set;
        }

        
        public IList<Product> data
        {
            get;
            set;
        }

        public void ShowProduct(int productID)
        {
           // product = DataHelper.getProduct(productID);
            //InitializeComponent();
            (Product.Content as Image).Source = product.PhotoSource;
            ProductName.Content = product.ProductName;
            ProductPrice.Content = product.Price;
        }
        
        private void Tile_Click(object sender, EventArgs e)
        {
            //var name = ((DevExpress.Xpf.LayoutControl.Tile)sender).Name;
            ShowProduct(((UCOLOR.Model.Product)(((DevExpress.Xpf.LayoutControl.Tile)sender).Content)).ID);
            //ShowDir(((DevExpress.Xpf.LayoutControl.Tile)sender).Uid);
        }
    }
}
